window.onload = function() {
    let lunbo = document.querySelector('.lunbo')
    let lunboBox = document.querySelector('.lunboBox')
    let mainImg = document.querySelector('.mainImg')
    let w = document.querySelectorAll('.w')

    function removeFilter() {
        for (let i = 0; i < w.length; i++) {
            w[i].classList.add("filterSelf");
            // console.log(1);
        }
    }

    let sumNum = 0
    let timerOut = 0
    let flag = 0
    let timer = setInterval(function() {
        if (flag != 6) {
            let timer = setInterval(function() {
                if (timerOut <= 120) {
                    lunboBox.style.left = -1 * sumNum + 'px'
                    sumNum++
                    timerOut++
                } else {
                    clearInterval(timer)
                }
            }, 8)
            timerOut = 0
            flag += 1
                // 下面是无缝连接--转换main图片src路径的改变
            if (flag + 2 == 7) {
                mainImg.src = `./images/girl1.bmp`
                removeFilter()
                    // document.querySelectorAll(`.filterImg1`).classList.remove("filterSelf");
                let filterImg1 = document.querySelectorAll(`.filterImg1`)
                for (let i = 0; i < filterImg1.length; i++) {
                    filterImg1[i].classList.remove("filterSelf");
                }
            } else if (flag + 2 == 8) {
                mainImg.src = `./images/girl2.bmp`
                removeFilter()
                    // document.querySelectorAll(`.filterImg2`).classList.remove("filterSelf");
                    // let filterImg2 = document.querySelectorAll(`.filterImg2`)
                    // for (let i = 0; i < filterImg1.length; i++) {
                    //     filterImg2[i].classList.remove("filterSelf");
                    // }
            } else {
                mainImg.src = `./images/girl${flag + 2}.bmp`
                removeFilter()
                document.querySelector(`.filterImg${flag + 2}`).classList.remove("filterSelf");
            }
        } else {
            flag = 0
            sumNum = 0
            lunboBox.style.left = '0'
        }

    }, 3000);


}